package cn.sheep.dolphin.config

import java.util.Properties

import com.typesafe.config.ConfigFactory
import scalikejdbc.config.DBs
import scala.collection.JavaConversions._

/**
  * 解析application.conf配置文件
  * author: old sheep
  * QQ: 64341393 
  * Created 2018/11/28
  */
object DolphinConfig {

	/*加载配置*/
	DBs.setup()

	private lazy val application = ConfigFactory.load()

	/* 解析运行模式 */
	val _power = application.getString("dolphin.common.power")

	/* 解析mysql配置 */
	val _driver = application.getString("dolphin.mysql.driver")
	val _url = application.getString("dolphin.mysql.url")
	val _username = application.getString("dolphin.mysql.username")
	val _password = application.getString("dolphin.mysql.password")

	/* mysql的属性参数封装 */
	val props = new Properties()
	props.setProperty("driver", _driver)
	props.setProperty("user", _username)
	props.setProperty("password", _password)


	/* redis configuration */
	val _redishost = application.getString("dolphin.redis.host")
	val _redisport = application.getInt("dolphin.redis.port")
	val _redisuser = application.getString("dolphin.redis.user")
	val _redispwd = application.getString("dolphin.redis.passwd")


	/* 解析高德参数配置 */
	val _gdReGEOURL = application.getString("dolphin.gd.regeo.url")
	val _keyList = application.getStringList("dolphin.gd.keys").toList

}
